﻿using System;
using System.Collections.Generic;
using System.Text;
using PostSharp.Aspects.Dependencies;

namespace Arcana.Contract.Property.Is.Not
{
    /// <summary>
    /// Specifies whether this property is not <b>null</b>.
    /// </summary>
    [Serializable]
    [AspectRoleDependency(AspectDependencyAction.Order, AspectDependencyPosition.Before, Roles.Conditional)]
    [ProvideAspectRole(Roles.Contract)]
    [ProvideAspectRole(Roles.Property)]
    [ProvideAspectRole(Roles.NullCheck)]
    public sealed class NullAttribute : ComparingContractBase
    {
        protected override bool ValidateProperty(object property)
        {
            return Comparer.Compare(property, null) != 0;
        }
    }
}
